Skip to content

Try fixing index OOB issues in Editable.checkSuggestionNeeded#6303

Merged
jmartinesp merged 1 commit intodevelopfrom
fix/index-oob-in-editable-check-suggestions-needed
Mar 10, 2026
Merged

Try fixing index OOB issues in Editable.checkSuggestionNeeded#6303
jmartinesp merged 1 commit intodevelopfrom
fix/index-oob-in-editable-check-suggestions-needed

Conversation

@jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented Mar 9, 2026

Content

  • Fix the case where the order for start and end is reversed.
  • Fix the case where start or end may be outside the editable's range (0..length).
  • Fix the case where the calculated indices to get the text for the suggestion may be invalid.

Added error logs for some of these issues.

Motivation and context

Try fixing https://github.com/element-hq/element-x-android-rageshakes/issues/10153

Tests

The bug report mentions changing the selection caused this issue for them, but I wasn't able to reproduce it. These are the only cases that came to mind that could cause the issue, given the boundaries are checked several times inside that function.

I tested the suggestions still worked after these changes though.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 16

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

- Fix the case where the order for `start` and `end` is reversed.
- Fix the case where `start` or `end` may be outside the editable's range (`0..length`).
@jmartinesp jmartinesp requested a review from a team as a code owner March 9, 2026 08:58
@jmartinesp jmartinesp requested review from ganfra and removed request for a team March 9, 2026 08:58
@jmartinesp jmartinesp added the PR-Bugfix For bug fix label Mar 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/Lphsw6

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.35%. Comparing base (0d033e0) to head (d699d10).
⚠️ Report is 33 commits behind head on develop.

Files with missing lines Patch % Lines
...tcomposer/components/markdown/MarkdownTextInput.kt 53.84% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6303      +/-   ##
===========================================
- Coverage    81.35%   81.35%   -0.01%     
===========================================
  Files         2575     2575              
  Lines        70033    70043      +10     
  Branches      8989     8991       +2     
===========================================
+ Hits         56975    56980       +5     
- Misses        9706     9710       +4     
- Partials      3352     3353       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jmartinesp jmartinesp merged commit 168470f into develop Mar 10, 2026
40 of 42 checks passed
@jmartinesp jmartinesp deleted the fix/index-oob-in-editable-check-suggestions-needed branch March 10, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Bugfix For bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants